/*
 * Copyright (c) 2017-2018,2021 Qualcomm Technologies, Inc.
 * All Rights Reserved.
 * Confidential and Proprietary - Qualcomm Technologies, Inc.
 */

#define LOG_TAG "vendor.qti.hardware.alarm@1.0-service"

#include <hidl/HidlTransportSupport.h>

#ifdef ARCH_ARM_32
#include <hwbinder/ProcessState.h>
#endif

#include "Alarm.h"

using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;

using vendor::qti::hardware::alarm::V1_0::IAlarm;
using vendor::qti::hardware::alarm::V1_0::implementation::Alarm;

using android::OK;
using android::sp;
using android::status_t;

int main() {
    android::sp<IAlarm> service = new Alarm();

#ifdef ARCH_ARM_32
    android::hardware::ProcessState::initWithMmapSize((size_t)8192);
#endif

    configureRpcThreadpool(1, true);
    status_t status = service->registerAsService();
    if (status != OK) {
        ALOGE("Cannot register Alarm HAL service.");
        return 1;
    }
    
    ALOGI("Alarm HAL service ready.");
    
    joinRpcThreadpool();
    
    ALOGI("Alarm HAL service failed to join thread pool.");

    return 1;
}

